package com.yueshop.product.feign;

import com.yueshop.common.to.SkuReductionTo;
import com.yueshop.common.to.SpuBoundTo;
import com.yueshop.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("yueshop-coupon")
public interface CouponFeignService {


    /**
     * yueshop-product  调用CouponFeignService saveSpuBounds方法 SpuBoundTo
     *  1.@RequestBody 将对象转为json
     *  2.找到yueshop-coupon 服务 coupon/spubounds/save 发送请求;
     *      会将上一步转的json 数据放在请求体位置,发送请求.
     *  3. 对放在接收到请求,将请求体中的json数据  转为 对象
     *  只要json数据模型是兼容的 双方无需使用一个to对象
     * @param spuBoundTo
     * @return
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
